<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

/**
 * 增加偏远地区 功能
 * Class AddRemoteRegionsFreightSetting
 */
class AddRemoteRegionsFreightSetting extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('commodity_activities', function (Blueprint $table) {
            $table->tinyInteger('remote_regions_freight')->default(2)->comment('是否开启偏远地区运费')->after('address_purchase_restriction');
            $table->json('remote_regions_freight_setting')->nullable()->comment('偏远地区运费设置')->after('remote_regions_freight');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('commodity_activities', function (Blueprint $table) {
            $table->dropColumn(['remote_regions_freight', 'remote_regions_freight_setting']);
        });
    }
}
